// eee.Sheffield.PZ.Imaging
//
// Copyright ?Ping Zou, 2007
// sg71.cherub@gmail.com

using System;
using System.Collections.Generic;
using System.Text;
using eee.Sheffield.PZ.Math;
using System.Drawing;
using System.Drawing.Imaging;
namespace eee.Sheffield.PZ.Imaging.ImageFilter
{
    public class ShowImage : ImageFilter, IGraylevelImageFilter
    {
        #region Field
        private Bitmap image;
        private string _log;
        private string _flag = "[Show Intermediary Image]";
        #endregion

        #region Properties
        public string Log() { return _log; }
        public string Flag() { return _flag; }
        #endregion

        #region constructor
        public ShowImage(Bitmap srcImage)
        {
            image = new Bitmap(srcImage);
        }
        #endregion

        #region Apply filter
        public Bitmap Apply(Bitmap srcImage) { return Apply(srcImage, out _log); }        
        public PZMath_matrix ApplyDouble(PZMath_matrix srcMatrix) { return ApplyDouble(srcMatrix, out _log); }

        private Bitmap Apply(Bitmap srcImage, out string logText)
        {
            logText = "succeeds.";
            return image;
        }        

        private PZMath_matrix ApplyDouble(PZMath_matrix srcMatrix, out string logText)
        {
            throw new ApplicationException("ShowImage::Apply(), the method is not valid under this circumstance.");
            
            #region source and dst matrix
            // get source
            int width = srcMatrix.ColumnCount;
            int height = srcMatrix.RowCount;

            // create dstMatrix
            PZMath_matrix dstMatrix = new PZMath_matrix(height, width);
            int heightM1 = height - 1;
            int widthM1 = width - 1;
            int heightM2 = height - 2;
            int widthM2 = width - 2;
            #endregion
            
            logText = "succeds.";
            return dstMatrix;
        }

        //private PZMath_matrix[] ApplyDouble(PZMath_matrix[] srcMatrix, out string logText)
        //{
        //    throw new ApplicationException("ShowImage::Apply(), the method is not valid under this circumstance.");

        //    // get source
        //    PZMath_matrix srcR = srcMatrix[0];
        //    PZMath_matrix srcG = srcMatrix[1];
        //    PZMath_matrix srcB = srcMatrix[2];

        //    int width = srcR.ColumnCount;
        //    int height = srcR.RowCount;

        //    // create dstMatrix
        //    PZMath_matrix[] dstMatrix = new PZMath_matrix[3];
        //    dstMatrix[0] = new PZMath_matrix(height, width);
        //    dstMatrix[1] = new PZMath_matrix(height, width);
        //    dstMatrix[2] = new PZMath_matrix(height, width);
        //    PZMath_matrix dstR = dstMatrix[0];
        //    PZMath_matrix dstG = dstMatrix[1];
        //    PZMath_matrix dstB = dstMatrix[2];
            
        //    logText = "succeds.";
        //    return dstMatrix;
        //}
        #endregion

    }
}
